#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QDebug>
#include <QMainWindow>
#include <QMessageBox>
#include <QFileDialog>
#include <QDesktopServices>
#include <QPrinter>
#include <QPrintDialog>
#include <QPrintPreviewDialog>
#include <QPrinter>
#include <QPainter>
#include <QSettings>

#include "gui/dock/projectdock/projektdock.h"
#include "uml/projects/umlproject.h"
#include "io/iomanager.h"

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow {
    Q_OBJECT

    friend class UmlProject;

public:
    enum PrintTarget {
        PDF,
        PostScript,
        Paper
    };

    MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
    ProjectDock *_projectDock;
    UmlProject *_project;
    QDockWidget *_toolDock;

    QPrinter *_printer;

    void initConnections();
    void initDocks();
    void changeEvent(QEvent *e);
    void setProject(UmlProject *project);

    void paintScene(QPainter *painter, QRectF targetRect, QRectF sourceRect);

private slots:
    void newProject();
    void openProject(QString filePath = "");
    void saveProject();
    void saveProjectAs();
    void closeProject();
    void showPreview();
    void printfToPage();
    void exportToPdf();
    void exportToImage();
    void print(QPrinter *printer);
    void quit();

    void exportXMI();
    void importXMI();
    void exportToJava();

signals:
    void projectLoaded(UmlProject *project);
};

#endif // MAINWINDOW_H
